<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<h1>The</h1>
<form>
    <input type="text" name="name">
    <input type="button" value="查询" onclick="doQueryBrands()">
    <button type="button" onclick="doAddUI()" >Add Brand</button>
</form>
<table>
    <thead>
    <tr>
        <th>id</th>
        <th>name</th>
        <th>remark</th>
        <th>createdTime</th>
        <th>operation</th>
    </tr>
    </thead>
    <tbody>
    <tr th:each="brand: ${list}">
        <td th:text="${brand.id}"></td>
        <td th:text="${brand.name}"></td>
        <td th:text="${brand.remark}"></td>
        <td th:text="${brand.createdTime}"></td>
        <td>
            <button type="button" th:onclick="doDeleteById([[${brand.id}]])">delete</button>
            <button type="button" th:onclick="doFindById('[[${brand.id}]]')">update</button>
        </td>
    </tr>
    </tbody>
</table>

<script>
    function doFindById(id){
        location.href=`http://localhost/brand/doFindById/${id}`;
    }
    function doQueryBrands(){
        let name=document.forms[0].name.value;
        location.href=`http://localhost/brand/doFindBrands/${name}`;
    }
    function doDeleteById(id){
        if (!confirm("确定删除吗"))return;
        location.href=`http://localhost/brand/doDeleteById/${id}`;
    }
    function doAddUI(){
        location.href="/brand/doAddUI";
    }
</script>
</body>

</html>